Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: remove unavailable EventEmitter TS export #36109

Closed
wants to merge 1 commit into from

Conversation

vonovak
Copy link
Collaborator

@vonovak vonovak commented Feb 9, 2023

Summary

currently, using TS, this is a valid import:

import { EventEmitter } from 'react-native';

However, looking at the index file we can see that there is no such export.

I first thought I'd add the EventEmitter export in order to get the index.js in line with the types, but it appears that the Event Emitter will become a separate package at some point #34401 so removing it from the types seems to be better for future.

Changelog

fix: remove unavailable EventEmitter TS export

Pick one each for the category and type tags:

[INTERNAL] [CHANGED] - remove unavailable EventEmitter TS export

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

Test Plan

tested locally: using import { EventEmitter } from 'react-native'; correctly gives TS2305: Module '"react-native"' has no exported member 'EventEmitter'.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 9, 2023
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,475,511 -582
android hermes armeabi-v7a 7,796,969 -631
android hermes x86 8,951,534 -572
android hermes x86_64 8,809,350 -545
android jsc arm64-v8a 9,113,298 -603
android jsc armeabi-v7a 8,309,955 -641
android jsc x86 9,164,882 -579
android jsc x86_64 9,423,778 -556

Base commit: 7535399
Branch: main

Copy link
Contributor

@NickGerleman NickGerleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it looks like I accidentally exported added this as newly public with my change to split up the typings.

@facebook-github-bot
Copy link
Contributor

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@vonovak
Copy link
Collaborator Author

vonovak commented Feb 9, 2023

LGTM, it looks like I accidentally exported added this as newly public with my change to split up the typings.

Actually not, it was that way before RN 71 as well 🙂

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 14, 2023
@facebook-github-bot
Copy link
Contributor

@NickGerleman merged this pull request in 7b14180.

@vonovak vonovak deleted the fix/event-emitter branch February 15, 2023 09:05
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Mar 24, 2023
Summary:
Discovered when bumping the RN documentation to typecheck against 0.72, facebook#36109 removed the `EmitterSubscription` type which should be kept public.

Changelog:
[General][Fixed] -  Export EmitterSubscription TypeScript Type

Differential Revision: D44375081

fbshipit-source-id: 859078b71044e8a70a25062ced5c8429a63c23be
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Mar 24, 2023
Summary:
Pull Request resolved: facebook#36632

Discovered when bumping the RN documentation to typecheck against 0.72, facebook#36109 removed the `EmitterSubscription` type which should be kept public.

Changelog:
[General][Fixed] -  Export EmitterSubscription TypeScript Type

Differential Revision: D44375081

fbshipit-source-id: 5b3f2343e8b3f224bfbc72b285f333afd45269bb
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Mar 24, 2023
Summary:
Pull Request resolved: facebook#36632

Discovered when bumping the RN documentation to typecheck against 0.72, facebook#36109 removed the `EmitterSubscription` type which should be kept public.

Changelog:
[General][Fixed] -  Export EmitterSubscription TypeScript Type

Differential Revision: D44375081

fbshipit-source-id: a75e4be326deedbeb06370860344f3c96b9a5426
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 17, 2023
Summary:
Pull Request resolved: facebook#36632

Discovered when bumping the RN documentation to typecheck against 0.72, facebook#36109 removed the `EmitterSubscription` type which should be kept public.

Changelog:
[General][Fixed] -  Export EmitterSubscription TypeScript Type

Reviewed By: cortinico

Differential Revision: D44375081

fbshipit-source-id: 74e1299749da9fb920742664a0ecccd871190947
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Apr 17, 2023
Summary:
Pull Request resolved: facebook#36632

Discovered when bumping the RN documentation to typecheck against 0.72, facebook#36109 removed the `EmitterSubscription` type which should be kept public.

Changelog:
[General][Fixed] -  Export EmitterSubscription TypeScript Type

Reviewed By: cortinico

Differential Revision: D44375081

fbshipit-source-id: 4f5e2b36a42c5917cea37a6f0cd0b53420cf6b27
facebook-github-bot pushed a commit that referenced this pull request Apr 17, 2023
Summary:
Pull Request resolved: #36632

Discovered when bumping the RN documentation to typecheck against 0.72, #36109 removed the `EmitterSubscription` type which should be kept public.

Changelog:
[General][Fixed] -  Export EmitterSubscription TypeScript Type

Reviewed By: cortinico

Differential Revision: D44375081

fbshipit-source-id: c8dbd5694d3a728a0a2091210894d27c9d84a012
kelset pushed a commit that referenced this pull request May 3, 2023
Summary:
Pull Request resolved: #36632

Discovered when bumping the RN documentation to typecheck against 0.72, #36109 removed the `EmitterSubscription` type which should be kept public.

Changelog:
[General][Fixed] -  Export EmitterSubscription TypeScript Type

Reviewed By: cortinico

Differential Revision: D44375081

fbshipit-source-id: c8dbd5694d3a728a0a2091210894d27c9d84a012
jeongshin pushed a commit to jeongshin/react-native that referenced this pull request May 7, 2023
Summary:
Pull Request resolved: facebook#36632

Discovered when bumping the RN documentation to typecheck against 0.72, facebook#36109 removed the `EmitterSubscription` type which should be kept public.

Changelog:
[General][Fixed] -  Export EmitterSubscription TypeScript Type

Reviewed By: cortinico

Differential Revision: D44375081

fbshipit-source-id: c8dbd5694d3a728a0a2091210894d27c9d84a012
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
currently, using TS, this is a valid import:

`import { EventEmitter } from 'react-native';`

However, looking at the [index file](https://github.com/facebook/react-native/blob/main/index.js) we can see that there is no such export.

I first thought I'd add the EventEmitter export in order to get the `index.js` in line with the types, but it appears that the Event Emitter will become a separate package at some point facebook#34401 so removing it from the types seems to be better for future.

## Changelog

fix: remove unavailable EventEmitter TS export

Pick one each for the category and type tags:

[INTERNAL] [CHANGED] - remove unavailable EventEmitter TS export

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

Pull Request resolved: facebook#36109

Test Plan: tested locally: using `import { EventEmitter } from 'react-native';` correctly gives `TS2305: Module '"react-native"' has no exported member 'EventEmitter'.`

Reviewed By: javache, cortinico

Differential Revision: D43155568

Pulled By: NickGerleman

fbshipit-source-id: b9e8c3f4be9812637c8588d14a9ce4edf188ed36
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Pull Request resolved: facebook#36632

Discovered when bumping the RN documentation to typecheck against 0.72, facebook#36109 removed the `EmitterSubscription` type which should be kept public.

Changelog:
[General][Fixed] -  Export EmitterSubscription TypeScript Type

Reviewed By: cortinico

Differential Revision: D44375081

fbshipit-source-id: c8dbd5694d3a728a0a2091210894d27c9d84a012
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants